package cn.entity;

import lombok.Value;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;

import java.util.List;

public interface StudentRepository extends JpaRepository<Student, Integer>,
        JpaSpecificationExecutor<Student> {

    List<Student> getStudentByName(String name);

    List<StudentDTO> findByName(String name);

    List<StudentDTO1> getByName(String name);

    <U> List<U> getStudentByName(String name, Class<U> type);
}

interface StudentDTO{
    String getName();
}

// 利用Lombok的@Value,构造返回类型DTO
@Value
class StudentDTO1{
    String name;
}

